home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / p / pofo / sprachen / pbasic / pbas30 / test30.bas < prev   
Encoding:
BASIC Source File  |  1991-08-22  |  5.4 KB  |  218 lines

  1.    if pbver < 3 then "Incorrect Version of PBASIC":stop
  2.    start = timer
  3.    dim ar(100), cr(100)
  4.    dim br(10)
  5.    cls
  6.    restore
  7.    a = -1
  8.    if port=1 then a=romver
  9.    print "rom Version ";a;"  Free: ";fre(0)
  10.    print "Running test of PBASIC 3.0 on ";
  11.    if port=0 then print "PC" else print "Portfolio"
  12.    read a,b : if a <> 1 then print "Read Error":stop
  13.    read a : if a <> 11 then print "Read Error":stop
  14.    read a : if a <> 12 then print "Data Error":stop
  15.  
  16.    y = 11
  17.    if y <> 11 then print "Assignment Error":stop
  18.    for x = 1 to 10
  19.      y = y + 2
  20.    next x
  21.    restore 13
  22.    read a : if a <> 21 then print "Restore Error":stop
  23.    if y = 31 then goto 10 else print "Loop Error":stop
  24.    print "this is never execute" : stop
  25. 10 a = 1
  26.    a = a + 15
  27.    if a <> 16 then print "Addition error":stop
  28.    a = a * 10
  29.    if a <> 160 then print "Multiply error":stop
  30.    a = a / 20
  31.    if a <> 8 then print "divide error":stop
  32.    a = a - 5
  33.    if a <> 3 then print "Subtraction Error":stop
  34.    a = 10
  35.    b = a \ 3
  36.    if b <> 3 then print "Int. Division Error":stop
  37.    b = a % 3
  38.    if b <> 1 then print "Mod Error":stop
  39.    if 2^5 <> 32 then print "Exp Error":stop
  40.    if int(12^2.5) <> int(498.831) then print "Exp Error":stop
  41.    if 2^-1 <> .5 then print "Exp Error":stop
  42.  
  43.    if fix(1234567.123)<>1234567 then print "Fix Error":stop
  44.    if int(1234565.123)<>1234565 then print "Int Error":stop
  45.  
  46. 11 data 1,2
  47. 12 data 11,12,13,14,15,16,17,18,19,20
  48. 13 data 21,22,23,24,25,26,27,28,29,30
  49.  
  50.    a = 1.23e+2 : if a<> 123 then print "Real Number error":stop
  51.    a = 1.23e-2 : if a <> .0123 then print "Real Number Error":stop
  52.  
  53.  
  54.    for a1 = 0 to 10
  55.       ar(a1) = a1 : br(a1) = ar(a1)
  56.    next
  57.  
  58.    if abs(-5)<>5 then print "ABS Error":stop
  59.    for a1 = 10 to 0 step -1
  60.       if ar(a1) <> br(a1) then print "Array Error" : stop
  61.    next a1
  62.  
  63.    m = 1
  64.    n = 2
  65.    swap m,n : if m<> 2 then print "Swap Error" :stop
  66.    swap m,n
  67.  
  68.    swap ar(7),br(8) : if br(8) <> 7 then print br(8), "Swap Error":stop
  69.    swap ar(7),br(8)
  70.  
  71.    swap ar(5), m : if m <> 5 then print "Swap Error":stop
  72.    swap m, ar(5) : if m <> 1 then print "Swap Error":stop
  73.    y = 12
  74.    for x = 10 to 1 step -1
  75.       y = y - 2
  76.    next x
  77.    if y = 10 then print "Loop error":stop
  78.    if y >= 0 then print "loop error":stop
  79.    if y < 10 then goto 20
  80.    print "If Error":stop
  81. 20 if y <= -8 then goto 30
  82.    print "If error":stop
  83. 30 if y <> -8 then print "Loop Error":stop
  84.    gosub 100
  85.    if y = -8 then "Gosub error":stop
  86.  
  87.    if &h100 <> 256 then print "Hex error":stop
  88.    if &o377 <> 255 then print "Octal error":stop
  89.    if 15 <> &17 then print "Octal error":stop
  90.  
  91.    if port=1 then def seg=&hb000 else def seg = &hb800
  92.    poke 0,196
  93.    if port=1 then refresh
  94.    if peek(0) <> 196 then print peek(0),"Peek/Poke/Seg Error":stop
  95.    poke 0,82
  96.    if port=1 then refresh
  97.  
  98.    abcde = 12345
  99.    rem abcde = 0
  100.    if abcde <> 12345 then print "Rem error":stop
  101.    'abcde = 1
  102.    if abcde = 1 then print "Rem Error":stop
  103.  
  104.    z = 1+2*3+4/5*6-1
  105.    w = 10.8
  106.    if z <> w then print z,w,"Precedence error":stop
  107.  
  108.    if sqr(100)<>10 then print "SQR Error":stop
  109.  
  110.    cx = csrlin : cy = pos(0)
  111.    locate 5,6
  112.    if csrlin <> 5 then print "Locate Error":stop
  113.    if pos(0) <> 6 then print "Locate Error":stop
  114.    locate cx, cy
  115.  
  116.    gosub 1234: ' string tests
  117.  
  118.       on port+1 goto 1000, 2000 'port tests
  119.       print "On Goto Error":stop
  120. 1000  print "End of test - OK"
  121.       print "Test took " timer-start " seconds" : end
  122.       end
  123.  
  124.  
  125. 100 y = 1 : return
  126.     print "Multiline or Return Error":stop
  127.  
  128.  
  129. 2000 'port tests
  130.      status 1
  131.      beep
  132.      status 1
  133.      locate 7,14
  134.      click
  135.      print "1-201-555-1234";
  136.      locate 7,13
  137.      status 0
  138.      box 6,11,8,30,1
  139.      dial "1-201-555-1234"
  140.      box 6,11,8,30,0
  141.      for ct = 48 to 63
  142.        sound ct, 15
  143.      next ct
  144.      locate 4,1
  145.      display 2 'static
  146.      vlocate 1,1
  147.      dir = 4:gosub 5000
  148.      dir = 2:gosub 5000
  149.      vx=vcsrlin:vy=vpos(0)
  150.      vlocate 11,12
  151.      if vcsrlin<>11 then print "VCSRLIN Error":stop
  152.      if vpos(0)<>12 then print "VPOS Error":stop
  153.      vlocate vx,vy
  154.      dir = 3:gosub 5000
  155.      dir = 1:gosub 5000
  156.      vlocate 1,1
  157.      goto 1000
  158.  
  159.  
  160. 5000  for xx = 1 to 5
  161.          vmove dir,1
  162.          click
  163.       next xx
  164.       return
  165.  
  166. 9999 print fre(0)
  167.   wait
  168.   return
  169.  
  170.  
  171.  
  172. '
  173. '  This the string test file.  It will be added to 
  174. '  TEST.BAS later.
  175. '
  176. '
  177. 1234
  178.  dim b(5,5)
  179.  for x = 1 to 5
  180.   for y = 1 to 5
  181.    if b(x,y)<>0 then print "Array Initialize Error":stop
  182.   next y
  183.  next x
  184.  
  185.  for x = 1 to 5
  186.   for y = 1 to 5
  187.    b(x,y) = (x-1)*5+y
  188.   next y
  189.  next x
  190.  
  191.  for x = 1 to 5
  192.   for y = 1 to 5
  193.    if b(x,y) <> (x-1)*5+y then print "Two Dimensional Array Error":stop
  194.   next y
  195.  next x
  196.  
  197.  dim sa$(10)
  198.  print time$;"  ";date$;"  Free ";fre(0)
  199.  sa$(1) = "array 1"
  200.  sa$(2) = "array 2"
  201.  if sa$(1)<>"array 1" then print "string array Error":stop
  202.  s$="BJGleason"
  203.  f$=left$(s$,2)
  204.  if f$<>"BJ" then print "Left$ Error":stop
  205.  m$=mid$(s$,2,2)
  206.  if m$<>"JG" then print "Mid$ Error":stop
  207.  if right$(s$,7)<>"Gleason" then print "Right$ Error":stop
  208.  if instr(s$,"Gle")<>3 then print "Instr Error":stop
  209.  c$ = "123"
  210.  d$ = c$ + "456" + c$
  211.  if d$<>"123456123" then print "String Cat Error":stop
  212.  if val("910")<>910 then print "Val Error":stop
  213.  if asc("1")<>49 then print "ASC Error":stop
  214.  qw$=str$(val(str$(val("66"))+"5")+1)
  215.  if qw$<>"666" then print "String Error":stop
  216.  if port=1 then dial d$
  217. return
  218. ə